import request from '@/utils/request'
import qs from 'qs'

const prefix = '/v1'
export function departmentAll() {
    return request.get(`${prefix}/department/all`) 
}

export function departmentList(params) {
    return request.get(`${prefix}/department/list`, {params}) 
}

export function treeList() {
    return request.get(`${prefix}/department/treeList`) 
}

export function saveOrUpdate(params) {
    return request.post(`${prefix}/department/saveOrUpdate`, params)
}

export function deleteById(id) {
    return request.post(`${prefix}/department/delete`, qs.stringify({id}, {
        method: 'POST',
        headers: {'content-type': 'application/x-www-form-urlencoded'}
    }));
}